#include "CentralWidget.h"
#include "ItemSelectionDialog.h"
#include <QDebug>
#include <QKeyEvent>


CentralWidget::CentralWidget(QWidget* parent)
	: QWidget(parent)
{
	initialize();
	setBackground();
}

CentralWidget::~CentralWidget() {}

void CentralWidget::setBackground()
{
	setAutoFillBackground(true);
	QPalette palette;
	palette.setColor(QPalette::Background, QColor(0,0,0));
	setPalette(palette);
}

void CentralWidget::initialize()
{
}

//void CentralWidget::keyPressEvent(QKeyEvent* e)
//{
//	qDebug() << e->key();
//	int key = e->key();
//	if (key >= Qt::Key_0 && key <= Qt::Key_9 
//			|| key >= Qt::Key_A && key <= Qt::Key_Z)
//	{
//		ItemSelectionDialog dialog(this);
//		dialog.setPressedKey(key);
//		dialog.exec();
//	}
//}

void CentralWidget::showStockDialog(int key)
{
	ItemSelectionDialog dialog(this);
	dialog.setPressedKey(key);
	dialog.exec();
}
